<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> -->

    <!-- 路径可能跟我不一样，需要修改 -->
    <script src="../js/vue.global.js"></script>
    <style>
        .outer {
            width: 500px;
            height: 500px;
            border: solid 0.3px grey;
        }

        .inner {
            width: 200px;
            height: 200px;
            border: solid 0.3px rgb(179, 60, 60);
        }
    </style>

</head>

<body>

    <div id="app">
        <div class="outer" @click="clickouter">

            <a href="http://www.baidu.com" @click.prevent="clickbaidu()">百度</a>
            <div>
                <div>计数器:{{counter}}</div>
                <button @click.once="counter++">点我+1</button>
            </div>
            <div class="inner" @click="clickinner($event)"></div>
            <div class="inner" @click.stop="clickinner2()"></div>


        </div>

    </div>


    <script>


        Vue.createApp({
            data() {
                return {
                    counter: 1
                }
            },
            methods: {
                clickouter() {
                    console.log(" outer  大框被点击；了")
                },
                clickinner(event) {
                    //阻止事件冒泡的方法
                    // event.stopPropagation()
                    console.log("inner 被点击；了", event)
                },
                clickinner2() {
                    console.log("inner222 被点击；了", event)
                },
                clickbaidu() {
                    console.log("点击百度的超链接");

                }
            }
        }).mount("#app")



    </script>




</body>

</html>